﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using web.data.entities;
using System.Configuration;
using Webdiyer.WebControls.Mvc;
using System.Web.UI;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Schema;
namespace web.bussines
{
    public class base_service 
    {
        //get property name for order by key string
        public static object GetPropertyValue(object obj, string property)
        {
            System.Reflection.PropertyInfo propertyInfo = obj.GetType().GetProperty(property);
            return propertyInfo.GetValue(obj, null);
        }

        //get type of property
        public static object GetPropertyType(object obj, string property)
        {
            System.Reflection.PropertyInfo propertyInfo = obj.GetType().GetProperty(property);
            return propertyInfo.GetType();
        }

        //tra ve language id theo url 
        public int? GetLanguageIDbyUrl(string url)
        {
            var arr = url.Split('/');
            int? languageID = web.component.global_const.LANGUAGE_ID_DEFAULT; ;
            //string languageCode = arr[1].ToString();
            //using (var data = new baseEntities())
            //{
            //    languageID = (from p in data.tbl_language
            //                  where p.language_code == languageCode 
            //                  select p.language_id).SingleOrDefault();
            //    return languageID;
            //}
            return languageID;
        }

      
    }
}
